package com.example.activitytest;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.example.activitytest.bean.Student;
import com.example.activitytest.bean.Teacher;

import java.util.ArrayList;

public class SecondActivity extends AppCompatActivity {
    private TextView mtext;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);
        Intent intent = getIntent();
        mtext = findViewById(R.id.text);
        mtext.setText(intent.getStringExtra("name"));
        Log.e("TAG", "onCreate: " );
        Log.e("TAG", "onCreate: "+intent.getBooleanExtra("boolean",false) );
        Log.e("TAG", "onCreate: "+intent.getByteExtra("byte", (byte) 0) );
        Log.e("TAG", "onCreate: "+intent.getCharExtra("String",'1' ) );
        Log.e("TAG", "onCreate: "+intent.getIntExtra("int",0 ) );
        Log.e("TAG", "onCreate: "+intent.getLongExtra("long",0L) );
        Log.e("TAG", "onCreate: "+intent.getFloatExtra("float",0.0F ) );
        Log.e("TAG", "onCreate: "+intent.getDoubleExtra("double",0.0 ) );
        Bundle bundle = intent.getBundleExtra("bundle");
        Log.e("TAG", "onCreate: "+bundle.getBundle("bundle") );
        Log.e("TAG", "onCreate: "+bundle.getInt("int") );

        int[] array=intent.getIntArrayExtra("array");
        for (int i :array) {
            Log.e("TAG", "=======array========== "+i );
        }

        ArrayList<String> list=intent.getStringArrayListExtra("list");
        for (String s : list) {
            Log.e("TAG", "=======list========== "+s );
        }

        Student student= (Student) intent.getSerializableExtra("student");
        Log.e("TAG", "=======student========== "+student );

        Teacher teacher =intent.getParcelableExtra("teacher");
        Log.e("TAG", "=======teacher========== "+teacher );



    }
    @Override
    protected void onStart() {
        super.onStart();
        Log.e("test111", "=========onStart=========");
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        Log.e("test111", "=========onRestart=========");
    }

    @Override
    protected void onResume() {
        super.onResume();
        Log.e("test111", "=========onResume=========");
    }

    @Override
    protected void onPause() {
        super.onPause();
        Log.e("test111", "=========onPause=========");
    }

    @Override
    protected void onStop() {
        super.onStop();
        Log.e("test111", "=========onStop=========");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        Log.e("test111", "=========onDestroy=========");
    }
}
